import { defineStore } from 'pinia'
import { MenuState } from './types/type'
import { getMenuList } from '@/api/menu'

const menuStore = defineStore('menu', {
  state: (): MenuState => {
    return {
      menuList: [],
    }
  },
  actions: {
    async getMenuData() {
      const result = await getMenuList()
      if (result.data) {
        this.menuList = result.data.menus
        return this.menuList
      }
      return null
    },
  },
  getters: {},
})

export default menuStore
